package com.atguigu.guli.service.edu.controller.api;

import com.atguigu.guli.service.base.result.R;
import com.atguigu.guli.service.edu.entity.Teacher;
import com.atguigu.guli.service.edu.service.TeacherService;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController

@RequestMapping("/api/edu/teacher")
@Api(tags = "用户的讲师模块")
public class ApiTeacherController {
    @Autowired
    private TeacherService teacherService;

    @ApiOperation("查看id讲师详情")
    @GetMapping("getById/{id}")
    public R getById(@PathVariable String id){

        Teacher teacher = teacherService.getById(id);
        return R.ok().data("item",teacher);
    }

    @GetMapping("list")
    @ApiOperation("查询讲师列表")
    public R listAll(){
        List<Teacher> list = teacherService.list();
        return R.ok().data("items",list).message("获取讲师列表成功");
    }
}
